package holdobject;

import sun.plugin.javascript.navig.Link;
import typeinfo.pets.Pet;
import typeinfo.pets.Pets;

import java.util.*;

public class CCIteration {
    public static void display(Iterator<Pet> it){
        while (it.hasNext()){
            Pet p=it.next();
            System.out.print(p.id()+":"+p+" ");
        }
        System.out.println();
    }

    public static void main(String[] args) {
        ArrayList<Pet> pets=Pets.arrayList(8);
        LinkedList<Pet> pets1=new LinkedList<Pet>(pets);
        TreeSet<Pet> pets2=new TreeSet<Pet>(pets);
        HashSet<Pet> pets3=new HashSet<Pet>(pets);
        display(pets.iterator());
        display(pets1.iterator());
        display(pets2.iterator());
        display(pets3.iterator());
    }

}





